import os
from crawl4ai import (
    AsyncWebCrawler,
    BrowserConfig,
    LLMConfig,
    CacheMode,
    CrawlerRunConfig,
    LLMExtractionStrategy,
)


def get_browser_config(
    cookies: list, headless: bool = False, verbose: bool = True
) -> BrowserConfig:
    """
    Returns the browser configuration for the crawler.

    Returns:
        BrowserConfig: The configuration settings for the browser.
    """
    # https://docs.crawl4ai.com/core/browser-crawler-config/
    return BrowserConfig(
        browser_type="chromium",  # Type of browser to simulate
        headless=headless,  # Whether to run in headless mode (no GUI)
        verbose=verbose,  # Enable verbose logging
        cookies=cookies,
    )


def get_llm_config() -> LLMConfig:
    """
    Returns the llm configuration for the crawler.

    Returns:
        LLMConfig: The configuration settings for the llm.
    """
    return LLMConfig(
        provider="deepseek/deepseek-chat", api_token=os.getenv("DEEPSEEK_API_KEY")
    )
